<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div style="display: block;">
        hello
    </div>
    <button id="btn">toggle</button>
    <script>
        var div = document.getElementsByTagName("div")[0]
        var btn = document.getElementById("btn")
        btn.onclick = function(){
            var d = div.style.display
            div.style.display =(d=="block")?"none":"block";
        }
    </script>
</body>
</html>